/* ---域名url信息数据----
*/
import { getPublicInfo } from '../api/extra';

let urlConfigData;
export async function urlConfig() {
    await getPublicInfo().then(res => {
        urlConfigData = res.data;
        sessionStorage.setItem('urlConfig', JSON.stringify(urlConfigData));
    })
}

export async function data() {
    if (sessionStorage.getItem('urlConfig')){
        urlConfigData = JSON.parse(sessionStorage.getItem('urlConfig'));
    }else{
        // console.log('取线上域名url信息数据')
        await urlConfig();
    }
    if (!urlConfigData) {
        urlConfigData = []
        alert('域名url信息接口数据异常！')
        return;
    }
    return urlConfigData;
}
export default { 
    data,
    urlConfig
}